
package com.hyst.seviceImpl;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.hyst.domain.WechatInterfaceView;
import com.hyst.repository.WechatInterfaceViewMapper;
import com.hyst.service.WechatInterfaceViewService;
import com.hyst.utils.UuidTool;

/**
 * @Description:
 * @Date：2018年09月22日 
 * @author： dy 
 * @version ：1.0 1.[2018年09月22日]
 */
@Service
public class WechatInterfaceViewServiceImpl implements WechatInterfaceViewService {

	@Autowired
	private WechatInterfaceViewMapper mapper;

	@Override
	public Page<WechatInterfaceView> list(final WechatInterfaceView wechatInterfaceView) {
		final Page<WechatInterfaceView> page = PageHelper.startPage(wechatInterfaceView.getPageNum(), wechatInterfaceView.getPageSize());
		mapper.select(wechatInterfaceView);
		return page;
	}

	@Override
	public WechatInterfaceView insert(final WechatInterfaceView wechatInterfaceView) {
		wechatInterfaceView.setStudentId(UuidTool.randomUUID());
		mapper.insertSelective(wechatInterfaceView);
		return wechatInterfaceView;
	}

	@Override
	public WechatInterfaceView getByPriKey(final String studentId) {
		final WechatInterfaceView wechatInterfaceView = mapper.selectByPrimaryKey(studentId);
		return wechatInterfaceView;
	}
	
	// 2018-9-23 chenbin: 
//	@Override
//	public WechatInterfaceView getByPhone(final String phone) {
//	
//		WechatInterfaceView wechat = new WechatInterfaceView();
//		wechat.setPhone(phone);
//		
//		mapper.selectByPhone(phone);
//		
//		return wechat;
//	}
	// 2018-9-23 chenbin: 
	@Override
	public Map<String, String> getMap(final String phone) {
	
		WechatInterfaceView wechat = new WechatInterfaceView();
		wechat.setPhone(phone);
		return mapper.selectMap(phone);
	}

	@Override
	public WechatInterfaceView updateSelective(final WechatInterfaceView wechatInterfaceView) {
		mapper.updateByPrimaryKeySelective(wechatInterfaceView);
		return wechatInterfaceView;
	}

	@Override
	public WechatInterfaceView update(final WechatInterfaceView wechatInterfaceView) {
		mapper.updateByPrimaryKey(wechatInterfaceView);
		return wechatInterfaceView;
	}

	@Override
	public WechatInterfaceView delete(final String studentId) {

		return null;
	}

}
